import React from "react";
import type {API} from "@/services/typings";

export interface IOrderData {
  customer: API.ICustomer;   // 客户信息
  items: IOrderItem[];
  remark?: string;
  totalPaid: number; // 实付金额，合计，优惠后商品金额
  totalPayable: number; // 应付金额，优惠前商品金额
  totalCashback?: number; // 返现
  deposit: number;  // 押金
  title: string;
  deliveryStartTime?: string |Date;
  deliveryEndTime?: string |Date;
  type: string;
  address?: API.ICustomerAddress
  facilityId?: string // 业务分区
}

export interface IOrderItem {
  id: string;
  name: string;
  unit?: string; // 单位
  amountUnit: number,// 单价
  amountPayable: number; // 原始总价(商品优惠前金额)
  amountActual: number; // 实际支付金额（商品优惠后金额）
  discountPrice: number; // 优惠金额
  returnPrice: number; // 返现金额
  rechargeCount: number; // 购买数量
  actualCount: number; // 最终到账数量
  giftCount: number; // 赠送商品数量
  tongPrice: number; // 桶单价
  buyTongNum: number;   // 购买桶数量
  returnTongNum: number;  // 回桶数量
  amountTotal: number; // 合计金额（商品金额+押金）
  image?: string;
  brandId?: string; // 品牌id
  brand?: string; // 品牌
  modelType?: string // 型号id
  needReturn?: string; // 是否需要回桶
  ticketNum: number,
  finalPrice: number; // 最终金额，商品总金额减去水票抵用金额
}

export type OrderPaymentMethod = "cash" | "wechat" | "alipay" | "monthly";

export interface IPaymentMethod {
  value: OrderPaymentMethod;
  permission: string;
  label: React.ReactNode;
  description: string;
}

export interface ICashModalInfo {
  title: string;
  tip: string;
  tipFooter: React.ReactNode;
}

export interface IPaymentResult {
  success: boolean;
  orderNum: string;
  amount: number;
  paymentMethod: OrderPaymentMethod;
  paidAt: string;
}
